package com.wf.course.service.impl;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.utils.page.PageBean;
import com.wf.course.dao.IGoodsTypeMapper;
import com.wf.course.model.goods.GoodsType;
import com.wf.course.service.IGoodsTypeService;

@Service
@Transactional(rollbackFor=Exception.class)
public class IGoodsTypeServiceImpl implements IGoodsTypeService{
	
	@Autowired
	private IGoodsTypeMapper mapper;

	@Override
	public void indexInfo(PageBean<GoodsType> pageBean) {
		// TODO Auto-generated method stub
		pageBean.setResults(this.mapper.queryList(pageBean));
		pageBean.setTotalCount(this.mapper.getTotalCount(pageBean).intValue());
	}

	@Override
	public void saveOrUpdateGoodsType(GoodsType goodsType) {
		// TODO Auto-generated method stub
		if(goodsType.getId()==null){
			this.mapper.saveGoodsType(goodsType);
		}else{
			this.mapper.updateGoodsType(goodsType);
		}
		
	}

	@Override
	public GoodsType queryGoodsTypeById(Integer id) {
		// TODO Auto-generated method stub
		return this.mapper.queryGoodsTypeById(id);
	}

	@Override
	public void deleteById(Integer id) {
		// TODO Auto-generated method stub
		this.mapper.deleteById(id);
	}

	@Override
	public List<GoodsType> queryGoodsTypes() {
		// TODO Auto-generated method stub
		return 	this.mapper.queryGoodsTypes();
	}

 
	
}
